package com.xoa.controller.document;

import com.xoa.service.document.DocumenSortFlowSerivce;
import com.xoa.util.common.wrapper.BaseWrapper;
import com.xoa.util.common.wrapper.BaseWrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by pfl on 2017/7/26.
 */
@RestController
@RequestMapping("/document")
public class DocumentSortFlowController {
    @Autowired
    DocumenSortFlowSerivce documenSortFlowSerivce;


    @RequestMapping("/sortFlow")
    public BaseWrappers sortFlow(HttpServletRequest request, String mainType,String detailType){
        return  documenSortFlowSerivce.sortFlow(request,mainType,detailType);
    }

    @RequestMapping("/getStatistics")
    public BaseWrappers getStatistics(HttpServletRequest request,@RequestParam(required = false,defaultValue = "0",name = "staType") Integer staType,String startTime,String endTime){
        return  documenSortFlowSerivce.getStatistics(request,staType,startTime,endTime);
    }

    @RequestMapping("/cancelDocument")
    public BaseWrapper cancelDocument(HttpServletRequest request, Integer runId){

        return documenSortFlowSerivce.cancelDocument(request,runId);
    }

    @RequestMapping("/getFlowDocument")

    public BaseWrappers getDocumentFlowType(){
        return  documenSortFlowSerivce.getDocumentFlowType();
    }

    @RequestMapping("/sortCommonDocument")
    public BaseWrappers sortCommonDocument(HttpServletRequest request, String mainType,String detailType){
        return  documenSortFlowSerivce.sortCommonDocument(request,mainType,detailType);
    }
}
